//
//  SelfInteractionManager.m
//  17DianYing
//
//  Created by apple on 15/9/24.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "SelfInteractionManager.h"

#import "AFNetworking.h"

@interface SelfInteractionManager ()

@property(nonatomic,strong)AFHTTPRequestOperationManager *afManager;
@property(nonatomic,strong)SelfInteractionManager *selfM;

@end



@implementation SelfInteractionManager


+(instancetype)share
{
    static SelfInteractionManager *m = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        m = [[SelfInteractionManager alloc]init];
    });
    return m;
}

-(void)getSelfIneractionWithToken:(NSString *)token BlockHoudle:(SelfManagerBlock)hb
{
    self.afManager = [[AFHTTPRequestOperationManager alloc]init];
//    self.afManager.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    NSString * url =[http stringByAppendingString:@"/mobile/user/center/getParticipate"];
    
    NSDictionary * dic =  @{@"token":token};
    AFHTTPRequestOperation *op = [self.afManager GET:url parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject)
    
//    AFHTTPRequestOperation *op = [self.afManager POST:url parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        //        NSArray *arr = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        
//                NSArray *arr = operation.responseObject;
//        
//                NSLog(@"%@",arr);
        
        //        NSLog(@"3333333333333333333333%@",dic);
        
        //        NSArray *arr = obj;
        
        //        NSLog(@"11111111111111111%@",arr);
        
        //        hb(arr);
        
//                [op start];
//        
//    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//         NSLog(@"%@",error.localizedDescription);
//    }];
    
    
    {
    
        NSArray *arr = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
//      
//        NSArray *arr = operation.responseObject;
        
        NSLog(@"%@",arr);
    
//        NSLog(@"3333333333333333333333%@",dic);
        
//        NSArray *arr = obj;
//       
//        NSLog(@"11111111111111111%@",arr);
        
        hb(arr);
        
        [op start];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"%@",error.localizedDescription);
    }];
    
}


@end
